Scroll Progress Bar

Constants

Constants are fixed quantities whose value does not change during Program execution.
  EX: 25, -3, 7.2, island, Mike

These constants are stored in various computer memory locations further use.

Types of constants
Primary constants Secondary constants
Integer Real Character String Enum Union Pointer Array Structures

Rules of integer constants:
  1. +ve or - ve
  2. It should not have , decimal point
  3. It must the dorcsithin the range -32768 to 32767
  4. Commas and blanks are not allowed.
Example:
Do
Don’t
25
20000
-2
5.0
2,000
50700
Rules of real constant:-
  1. +ve or - ve
  2. It should have a decimal point.
  3. Commas and blanks are not allowed.
  4. The range of Real constants in Exponential form is -3.4e38 to 3.4e38.
Example:
Do
Don’t
-2.75
5.29
5.0
5
Rules of character constant:-
  1. It can be a single alphabet
  2. Single digit
  3. Single special symbol enclosed within single quotes.
Examples:
'A' '7' '?'
Rules of string constants:-

Groups of character are enclosed within double quotations.

Examples:
"ABCD" "1234" "A"

What is a constant that cannot be changed in C?


Immutable

What keyword is used to define a constant in C?


const

What type of constant is represented by '12345' in C?


Integer

What type of constant is represented by '3.14' in C?


Floating

What is the purpose of using constants in C?


Consistency